﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Web.Mvc;
using DAL;

namespace ViewModel
{
    [DataContract]
    public class AdmListModel
    {
        [DataMember]
        [Display(Name = "姓名")]
        public string Name { get; set; }

        [IgnoreDataMember]
        public byte Role { get; set; }

        [DataMember]
        [Display(Name = "管理角色")]
        public string RoleTxt
        {
            get { return DAL.Enums.emAdmRole.Get(Role).Text; }
            set
            {
                byte type = 1;
                Role = DAL.Enums.emAdmRole.Get(type).Value;
            }
        }

        [DataMember]
        [Display(Name = "财富")]
        public float Wallet { get; set; }

        [IgnoreDataMember]
        private string _LivePhone = "0";

        [DataMember]
        [Display(Name = "联系方式")]
        public string LivePhone { get { return string.IsNullOrWhiteSpace(_LivePhone) ? "0" : _LivePhone; } set { _LivePhone = value; } }

        [DataMember]
        [Display(Name = "ID")]
        public int ID { get; set; }
    }

    public class AdmLogOnModel
    {
        [Required(ErrorMessage = "请输入用户名")]
        [Display(Name = "用户名")]
        public string UserName { get; set; }

        [Required(ErrorMessage = "请输入密码")]
        [DataType(DataType.Password)]
        [Display(Name = "密码")]
        public string Password { get; set; }

        [Display(Name = "是否自动登录?")]
        public bool RememberMe { get; set; }
    }

    public class AdmCreateModel
    {
        [Required]
        [Display(Name = "用户名")]
        public string LoginID { get; set; }

        [Required]
        [StringLength(100, ErrorMessage = "{0}必须至少大于{2}个字符的的长度..", MinimumLength = 6)]
        [DataType(DataType.Password)]
        [Display(Name = "密码")]
        public string LoginPwd { get; set; }

        [Display(Name = "姓名")]
        public string Name { get; set; }

        [Required]
        [Display(Name = "管理角色")]
        public string RoleStr { get; set; }

        [Display(Name = "联系方式")]
        public string LivePhone { get; set; }
    }

    public class AdmEditModel
    {
        [Display(Name = "用户名")]
        public string Security_LoginID { get; set; }

        [DataType(DataType.Password)]
        [Display(Name = "密码")]
        public string Security_LoginPwd { get; set; }

        [Display(Name = "姓名")]
        public string Name { get; set; }

        [Display(Name = "管理角色")]
        public string RoleStr { get; set; }

        [Display(Name = "联系方式")]
        public string LivePhone { get; set; }
        public int ID { get; set; }
    }

    public class AdmEditColsModel
    {
        /// <summary>
        /// ID
        /// </summary>
        public int ID { get; set; }

        [Display(Name = "权限字符串")]
        public string AdmCol { get; set; }
    }
}
